from flask import Flask
from .setting import DevConfig
from .model import db
from app.api.jiaoyu_api import jiaoyu
from app.api.zhaosheng_api import zhaosheng
from app.api.upload_api import upfile
from app.api.handle_api import handle


def create_app():

    app=Flask(__name__,static_url_path='',static_folder='static/dist')
    
    app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
    app.config['SQLALCHEMY_COMMIT_TEARDOWN'] = True
    app.config['SQLALCHEMY_DATABASE_URI']=DevConfig.SQLALCHEMY_DATABASE_URI
    app.config['JSON_AS_ASCII'] = False
    app.debug = True
    db.init_app(app)
    #教育api的蓝图注册
    app.register_blueprint(jiaoyu)
    app.register_blueprint(zhaosheng)
    app.register_blueprint(upfile)
    app.register_blueprint(handle)


    return app



